<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    li {
      padding: 4px;
    }

    body {
      padding-top: 100px;
      height: 100vh;
      display: flex;
      /* align-items: center; */
      justify-content: center;
    }
  </style>
  <body>
    <div
      id="container"
      style="height: 200px; border: 1px solid black; overflow: hidden"
    >
      <ul id="ul1">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
        <li>6</li>
        <li>7</li>
        <li>8</li>
        <li>9</li>
        <li>10</li>
        <li>11</li>
        <li>12</li>
        <li>13</li>
        <li>14</li>
        <li>15</li>
        <li>16</li>
        <li>17</li>
        <li>18</li>
        <li>19</li>
      </ul>
      <!-- <ul id="ul2">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
        <li>6</li>
        <li>7</li>
        <li>8</li>
        <li>9</li>
      </ul> -->
    </div>
  </body>

  <script>
    let i = 14;
    const ul1 = document.getElementById("ul1");
    const ul2 = ul1.cloneNode(true);
    ul1.parentNode.appendChild(ul2);
    const height = ul1.children[0].offsetHeight;
    const length = ul1.children.length;

    //    ul1.style.transform = `translateY(-${(i % length) * height}px)`;
    // ul2.style.transform = `translateY(-${(i % length) * height}px)`;

    setInterval(() => {
      ul1.style.transform = `translateY(-${(i % length) * height}px)`;
      ul2.style.transform = `translateY(-${(i % length) * height}px)`;

      i++;
    }, 1000);
  </script>
</html>
